|
|
Am 29.06.2010 21:37, schrieb Gyscos:
> Wow, I understand what didn't work...
> Well, partly...
>
> I used the macro in a declare :
>
> #declare MyVar = MyMacro(MyStuff);
>
> But POV-Ray parsed the macro and found some #if and #else BEFORE the expected
> semi-colon...
>
> :-/
>
> So I have to put the semi-colon IN the macro, and not in the #declare line...
> :(
>
> I think I'll use extra arguments to return the value instead...
This one will do:
#macro MyMacro(arg)
#if (arg > 1)
#local RetVal = 5;
#else
#local RetVal = 10;
#end
RetVal
#end
Note that the value to be returned is stored in a local variable first,
which is then "returned" at the very end of the macro.
Extra arguments as return values are pretty cumbersome, as you'll always
have to make sure that the respective variable is defined properly
before being passed to (and back from) the macro.
Post a reply to this message
|
|